/**
 * 
 */
package org.jft.datamodel.database.dao.implementation;

import java.sql.SQLException;
import java.util.List;

import org.hibernate.Session;
import org.jft.datamodel.database.HibernateUtil;
import org.jft.datamodel.database.dao.GenericDAO;
import org.jft.datamodel.database.mapping.Event;

/**
 * @author LAP
 *
 */
public class EventDAO extends GenericDAO<Event> {

	@Override
	public Event getByID(Long id) throws SQLException {
		Session session = HibernateUtil.getInstance().getSessionFactory().getCurrentSession();
		Event event = (Event) session.load(Event.class, id);
		return event;
	}

	@Override
	public List<Event> getAll() throws SQLException {
		Session session = HibernateUtil.getInstance().getSessionFactory().getCurrentSession();
		List<Event> events = session.createCriteria(Event.class).list();
		return events;
	}

}
